package com.cloudcc.mobile.view.aduit.adapter;

import android.content.Context;

import com.cloudcc.cloudframe.adapter.NewCommonAdapter;
import com.cloudcc.cloudframe.adapter.ViewHolder;
import com.cloudcc.mobile.R;
import com.cloudcc.mobile.view.aduit.bean.assetsBean;


/**
 * <pre>
 *     author : 92152
 *     e-mail : xxx@xx
 *     time   : 2019/12/03
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class NearByAgentAdapter extends NewCommonAdapter {

    public NearByAgentAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    public void convert(ViewHolder holder, Object o, int position) {
        assetsBean assetsBean = (assetsBean) o;
        holder.setText(R.id.near_by_list_item_name , (position+1)+"."+assetsBean.getName());
        String distanceNow = String.format(mContext.getResources().getString(R.string.near_by_now_distance), assetsBean.getDistance()+"m");
        holder.setText(R.id.near_by_list_item_long , (assetsBean.getDistance() == -1 ? mContext.getString(R.string.null_now) : distanceNow));
        holder.setText(R.id.near_by_list_item_address , assetsBean.getTfdz());
    }


    @Override
    public int getLayoutId() {
        return R.layout.near_by_list_item;
    }

}
